package com.example.demo.Repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.example.demo.Entity.HumanResource;

/**
 * @version: V0.3
 * @author: 郑皓杰 吴嘉鑫
 * @className: IHRRepository
 * @packageName: com.example.demo.Repository
 * @description: 这是HR实体数据链接的接口
 * @data: 2021-07-14
 **/

public interface IHRRepository extends JpaRepository<HumanResource, Integer>{
	public HumanResource findByCompanyID(Integer companyID);
	public HumanResource findByUsername(String username);
   
	@Query(value = "select companyid from hr b  where b.username=?1",nativeQuery = true)
	public Integer findCompanyIDbyUsername(String username);
	
	@Query(value = "select company_name from hr b  where b.username=?1",nativeQuery = true)
	public String findCompanyNamebyUsername(String username);
	
	@Query(value = "select b from hr b  where b.username=?1",nativeQuery = true)
	public List<HumanResource> fingByState(boolean b);
}
